#!/bin/bash

# 软件配置文件软链接设置脚本
yay -S lf

#图片预览功能需要安装 ueberzug、w3m
sudo pacman -S ueberzug w3m
yay -S perl-image-exiftool
sudo pacman -S chafa
sudo pacman -S archivemount

# 获取当前脚本目录位置
cd `dirname $0`
dir=`pwd`
echo ${dir}


# 备份 lf 配置文件
mv ~/.config/lf ~/.config/lf-`date +%y%m%d%H%M%S`
# 建立软链接命令拼接
cmdStr="ln -s  "${dir}"/  "${HOME}"/.config/lf"
echo "执行命令: ${cmdStr} 建立软链接"
${cmdStr}

sudo rm -f /usr/bin/lf-ueberzug
sudo rm -f /usr/bin/lf-ueberzug-cleaner
sudo rm -f /usr/bin/lf-ueberzug-previewer

# 将if-ueberzug添加到/usr/bin中
#sudo mv ./lf-ueberzug /usr/bin
#sudo mv ./lf-ueberzug-cleaner /usr/bin
#sudo mv ./lf-ueberzug-previewer /usr/bin
# 建立软链接命令拼接
cmdStr="sudo ln -s  "${dir}"/lf-ueberzug /usr/bin"
echo "执行命令: ${cmdStr} 建立软链接"
${cmdStr}

cmdStr="sudo ln -s  "${dir}"/lf-ueberzug-cleaner /usr/bin"
echo "执行命令: ${cmdStr} 建立软链接"
${cmdStr}

cmdStr="sudo ln -s  "${dir}"/lf-ueberzug-previewer /usr/bin"
echo "执行命令: ${cmdStr} 建立软链接"
${cmdStr}


